<?php

class UserController extends Zend_Controller_Action {

    public function init() {
        /* Initialize action controller here */
    }

    public function indexAction() {
        $this->view->usersAll = $this->getUsersAll();
        
    }
    private function getUsersAll() {
        $dbUser = new Application_Model_DbTable_Users();
        return $dbUser->fetchAll()->toArray();
    }

    public function addAction() {
        $form = new Application_Form_UserManage();
        $this->view->formUser = $form;
        if ($this->_request->isPost()) {
            $formData = $this->_request->getPost();
//            if ($form->isValid($formData)) {
//                $users = new Model_DbTable_Users();
//                $row = $users->createRow();
//                $row->nom = $form->getValue('nom');
//                $row->prenom = $form->getValue('prenom');
//                $row->email = $form->getValue('email');
//                $row->password = md5($form->getValue('password'));
//                $row->active = $form->getValue('active');
//                $row->level = $form->getValue('level');
//                $result = $row->save();
////On gere le resultat et l'action qui s'en suit.
//                $form->reset();
//            }
        }
    }

   

}

